/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AppFrame.java
 *
 * Created on Apr 16, 2010, 6:36:48 PM
 */

package edu.asu.cse360.client.ui.frame;

import edu.asu.cse360.context.ServiceFactory;
import java.awt.CardLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

/**
 *This is the main frame for the entire program
 * @author ggreiner
 */

public class AppFrame extends javax.swing.JFrame {
    private static AppFrame instance;
    /** Creates new form AppFrame */
    private AppFrame() {
        initComponents();
        setExtendedState(getExtendedState()|JFrame.MAXIMIZED_BOTH);
    }
    public static AppFrame getAppFrame(){
        if(instance == null)
            instance = new AppFrame();
        return instance;
    }

    public JPanel  getChefOrderContainer(){
        return chefOrderContainer;
    }

    public JPanel getWaitPersonOrdersContainer()
    {
        return waitPersonOrdersContainer;
    }
    public JPanel getTableStatusContainer()
    {
        return waitPersonTablesContainer;
    }

    public JPanel getCustomerMenuContainer(){
        return viewMenuContainer;
    }

    public JPanel getCustomerOrderContainer(){
        return customerOrdersContainer;
    }

    public JPanel getCustomerPaymentContainer(){
        return makePaymentContainer;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        managerPanel = new javax.swing.JPanel();
        managerTabbedPane = new javax.swing.JTabbedPane();
        menuEditContainer = new javax.swing.JPanel();
        staffEditContainer = new javax.swing.JPanel();
        menuReportContainer = new javax.swing.JPanel();
        staffReportContainer = new javax.swing.JPanel();
        waitPersonPanel = new javax.swing.JPanel();
        waitPersonTabbedPane = new javax.swing.JTabbedPane();
        waitPersonOrdersContainer = new javax.swing.JPanel();
        waitPersonTablesContainer = new javax.swing.JPanel();
        chefPanel = new javax.swing.JPanel();
        chefTabbedPane = new javax.swing.JTabbedPane();
        chefOrderContainer = new javax.swing.JPanel();
        customerPanel = new javax.swing.JPanel();
        customerTabbedPane = new javax.swing.JTabbedPane();
        viewMenuContainer = new javax.swing.JPanel();
        customerOrdersContainer = new javax.swing.JPanel();
        makePaymentContainer = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.CardLayout());

        org.jdesktop.layout.GroupLayout menuEditContainerLayout = new org.jdesktop.layout.GroupLayout(menuEditContainer);
        menuEditContainer.setLayout(menuEditContainerLayout);
        menuEditContainerLayout.setHorizontalGroup(
            menuEditContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        menuEditContainerLayout.setVerticalGroup(
            menuEditContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        managerTabbedPane.addTab("Edit Menu", menuEditContainer);

        org.jdesktop.layout.GroupLayout staffEditContainerLayout = new org.jdesktop.layout.GroupLayout(staffEditContainer);
        staffEditContainer.setLayout(staffEditContainerLayout);
        staffEditContainerLayout.setHorizontalGroup(
            staffEditContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        staffEditContainerLayout.setVerticalGroup(
            staffEditContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        managerTabbedPane.addTab("Edit Staff", staffEditContainer);

        org.jdesktop.layout.GroupLayout menuReportContainerLayout = new org.jdesktop.layout.GroupLayout(menuReportContainer);
        menuReportContainer.setLayout(menuReportContainerLayout);
        menuReportContainerLayout.setHorizontalGroup(
            menuReportContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        menuReportContainerLayout.setVerticalGroup(
            menuReportContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        managerTabbedPane.addTab("Menu Report", menuReportContainer);

        org.jdesktop.layout.GroupLayout staffReportContainerLayout = new org.jdesktop.layout.GroupLayout(staffReportContainer);
        staffReportContainer.setLayout(staffReportContainerLayout);
        staffReportContainerLayout.setHorizontalGroup(
            staffReportContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        staffReportContainerLayout.setVerticalGroup(
            staffReportContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        managerTabbedPane.addTab("Staff Report", staffReportContainer);

        org.jdesktop.layout.GroupLayout managerPanelLayout = new org.jdesktop.layout.GroupLayout(managerPanel);
        managerPanel.setLayout(managerPanelLayout);
        managerPanelLayout.setHorizontalGroup(
            managerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(managerTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1106, Short.MAX_VALUE)
        );
        managerPanelLayout.setVerticalGroup(
            managerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(managerTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 512, Short.MAX_VALUE)
        );

        getContentPane().add(managerPanel, "managerCard");

        org.jdesktop.layout.GroupLayout waitPersonOrdersContainerLayout = new org.jdesktop.layout.GroupLayout(waitPersonOrdersContainer);
        waitPersonOrdersContainer.setLayout(waitPersonOrdersContainerLayout);
        waitPersonOrdersContainerLayout.setHorizontalGroup(
            waitPersonOrdersContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        waitPersonOrdersContainerLayout.setVerticalGroup(
            waitPersonOrdersContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        waitPersonTabbedPane.addTab("Orders", waitPersonOrdersContainer);

        org.jdesktop.layout.GroupLayout waitPersonTablesContainerLayout = new org.jdesktop.layout.GroupLayout(waitPersonTablesContainer);
        waitPersonTablesContainer.setLayout(waitPersonTablesContainerLayout);
        waitPersonTablesContainerLayout.setHorizontalGroup(
            waitPersonTablesContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        waitPersonTablesContainerLayout.setVerticalGroup(
            waitPersonTablesContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        waitPersonTabbedPane.addTab("Tables", waitPersonTablesContainer);

        org.jdesktop.layout.GroupLayout waitPersonPanelLayout = new org.jdesktop.layout.GroupLayout(waitPersonPanel);
        waitPersonPanel.setLayout(waitPersonPanelLayout);
        waitPersonPanelLayout.setHorizontalGroup(
            waitPersonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1106, Short.MAX_VALUE)
            .add(waitPersonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, waitPersonTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1106, Short.MAX_VALUE))
        );
        waitPersonPanelLayout.setVerticalGroup(
            waitPersonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 512, Short.MAX_VALUE)
            .add(waitPersonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(waitPersonTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 512, Short.MAX_VALUE))
        );

        getContentPane().add(waitPersonPanel, "waitPersonCard");

        org.jdesktop.layout.GroupLayout chefOrderContainerLayout = new org.jdesktop.layout.GroupLayout(chefOrderContainer);
        chefOrderContainer.setLayout(chefOrderContainerLayout);
        chefOrderContainerLayout.setHorizontalGroup(
            chefOrderContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        chefOrderContainerLayout.setVerticalGroup(
            chefOrderContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        chefTabbedPane.addTab("Orders", chefOrderContainer);

        org.jdesktop.layout.GroupLayout chefPanelLayout = new org.jdesktop.layout.GroupLayout(chefPanel);
        chefPanel.setLayout(chefPanelLayout);
        chefPanelLayout.setHorizontalGroup(
            chefPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(chefTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1106, Short.MAX_VALUE)
        );
        chefPanelLayout.setVerticalGroup(
            chefPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(chefTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 512, Short.MAX_VALUE)
        );

        getContentPane().add(chefPanel, "chefCard");

        org.jdesktop.layout.GroupLayout viewMenuContainerLayout = new org.jdesktop.layout.GroupLayout(viewMenuContainer);
        viewMenuContainer.setLayout(viewMenuContainerLayout);
        viewMenuContainerLayout.setHorizontalGroup(
            viewMenuContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        viewMenuContainerLayout.setVerticalGroup(
            viewMenuContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        customerTabbedPane.addTab("View Menu", viewMenuContainer);

        org.jdesktop.layout.GroupLayout customerOrdersContainerLayout = new org.jdesktop.layout.GroupLayout(customerOrdersContainer);
        customerOrdersContainer.setLayout(customerOrdersContainerLayout);
        customerOrdersContainerLayout.setHorizontalGroup(
            customerOrdersContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        customerOrdersContainerLayout.setVerticalGroup(
            customerOrdersContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        customerTabbedPane.addTab("Orders", customerOrdersContainer);

        org.jdesktop.layout.GroupLayout makePaymentContainerLayout = new org.jdesktop.layout.GroupLayout(makePaymentContainer);
        makePaymentContainer.setLayout(makePaymentContainerLayout);
        makePaymentContainerLayout.setHorizontalGroup(
            makePaymentContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1101, Short.MAX_VALUE)
        );
        makePaymentContainerLayout.setVerticalGroup(
            makePaymentContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 484, Short.MAX_VALUE)
        );

        customerTabbedPane.addTab("Make Payment", makePaymentContainer);

        org.jdesktop.layout.GroupLayout customerPanelLayout = new org.jdesktop.layout.GroupLayout(customerPanel);
        customerPanel.setLayout(customerPanelLayout);
        customerPanelLayout.setHorizontalGroup(
            customerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, customerTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1106, Short.MAX_VALUE)
        );
        customerPanelLayout.setVerticalGroup(
            customerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, customerTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 512, Short.MAX_VALUE)
        );

        getContentPane().add(customerPanel, "customerCard");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public JPanel getMenuEditContainer(){
        return menuEditContainer;
    }

    public JPanel getStaffEditContainer(){
        return staffEditContainer;
    }

    public JPanel getMenuReportContainer(){
        return menuReportContainer;
    }

    public JPanel getStaffReportContainer(){
        return staffReportContainer;
    }


    public JPanel getWaitPersonTablesContainer(){
        return waitPersonTablesContainer;
    }

    public JTabbedPane getCustomerTabbedPane(){
        return customerTabbedPane;
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        ServiceFactory.setUseClientServices(true);
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JFrame frame = new JFrame();
                new AppFrame().setVisible(true);
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setSize(5000, 5000);
                //frame.pack();
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel chefOrderContainer;
    private javax.swing.JPanel chefPanel;
    private javax.swing.JTabbedPane chefTabbedPane;
    private javax.swing.JPanel customerOrdersContainer;
    private javax.swing.JPanel customerPanel;
    private javax.swing.JTabbedPane customerTabbedPane;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JPanel makePaymentContainer;
    private javax.swing.JPanel managerPanel;
    private javax.swing.JTabbedPane managerTabbedPane;
    private javax.swing.JPanel menuEditContainer;
    private javax.swing.JPanel menuReportContainer;
    private javax.swing.JPanel staffEditContainer;
    private javax.swing.JPanel staffReportContainer;
    private javax.swing.JPanel viewMenuContainer;
    private javax.swing.JPanel waitPersonOrdersContainer;
    private javax.swing.JPanel waitPersonPanel;
    private javax.swing.JTabbedPane waitPersonTabbedPane;
    private javax.swing.JPanel waitPersonTablesContainer;
    // End of variables declaration//GEN-END:variables

    public void showCard(String cardName) {
        CardLayout cardLayout = (CardLayout)this.getContentPane().getLayout();
        cardLayout.show(this.getContentPane(), cardName);
    }

}
